home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / avalnche.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  5KB  |  191 lines

  1. /***************************************************************************
  2.  
  3. Atari Avalanche Driver
  4.  
  5. Memory Map:
  6.                 0000-1FFF                RAM
  7.                 2000-2FFF        R        INPUTS
  8.                 3000-3FFF        W        WATCHDOG
  9.                 4000-4FFF        W        OUTPUTS
  10.                 5000-5FFF        W        SOUND LEVEL
  11.                 6000-7FFF        R        PROGRAM ROM
  12.                 8000-DFFF                UNUSED
  13.                 E000-FFFF                PROGRAM ROM (Remapped)
  14.  
  15. If you have any questions about how this driver works, don't hesitate to
  16. ask.  - Mike Balfour (mab22@po.cwru.edu)
  17. ***************************************************************************/
  18.  
  19. #include "driver.h"
  20. #include "vidhrdw/generic.h"
  21.  
  22. /* machine/avalnche.c */
  23. READ_HANDLER( avalnche_input_r );
  24. WRITE_HANDLER( avalnche_output_w );
  25. WRITE_HANDLER( avalnche_noise_amplitude_w );
  26. int avalnche_interrupt(void);
  27.  
  28. /* vidhrdw/avalnche.c */
  29. WRITE_HANDLER( avalnche_videoram_w );
  30. void avalnche_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  31.  
  32. static struct MemoryReadAddress readmem[] =
  33. {
  34.     { 0x0000, 0x1fff, MRA_RAM }, /* RAM SEL */
  35.     { 0x2000, 0x2fff, avalnche_input_r }, /* INSEL */
  36.     { 0x6000, 0x7fff, MRA_ROM }, /* ROM1-ROM2 */
  37.     { 0xe000, 0xffff, MRA_ROM }, /* ROM2 for 6502 vectors */
  38.     { -1 }    /* end of table */
  39. };
  40.  
  41. static struct MemoryWriteAddress writemem[] =
  42. {
  43.     { 0x0000, 0x1fff, avalnche_videoram_w, &videoram, &videoram_size }, /* DISPLAY */
  44.     { 0x3000, 0x3fff, MWA_NOP }, /* WATCHDOG */
  45.     { 0x4000, 0x4fff, avalnche_output_w }, /* OUTSEL */
  46.     { 0x5000, 0x5fff, avalnche_noise_amplitude_w }, /* SOUNDLVL */
  47.     { 0x6000, 0x7fff, MWA_ROM }, /* ROM1-ROM2 */
  48.     { 0xe000, 0xffff, MWA_ROM }, /* ROM1-ROM2 */
  49.     { -1 }    /* end of table */
  50. };
  51.  
  52.  
  53.  
  54. INPUT_PORTS_START( avalnche )
  55.     PORT_START /* IN0 */
  56.     PORT_BIT (0x03, IP_ACTIVE_HIGH, IPT_UNKNOWN ) /* Spare */
  57.     PORT_DIPNAME( 0x0c, 0x04, DEF_STR( Coinage ) )
  58.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_1C ) )
  59.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_1C ) )
  60.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_2C ) )
  61.     PORT_DIPSETTING(    0x00, DEF_STR( Free_Play ) )
  62.     PORT_DIPNAME( 0x30, 0x00, "Language" )
  63.     PORT_DIPSETTING(    0x00, "English" )
  64.     PORT_DIPSETTING(    0x30, "German" )
  65.     PORT_DIPSETTING(    0x20, "French" )
  66.     PORT_DIPSETTING(    0x10, "Spanish" )
  67.     PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_START2 )
  68.     PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_START1 )
  69.  
  70.     PORT_START /* IN1 */
  71.     PORT_BIT ( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
  72.     PORT_BIT ( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 )
  73.     PORT_DIPNAME( 0x04, 0x04, "Allow Extended Play" )
  74.     PORT_DIPSETTING(    0x00, DEF_STR( No ) )
  75.     PORT_DIPSETTING(    0x04, DEF_STR( Yes ) )
  76.     PORT_DIPNAME( 0x08, 0x00, "Lives/Extended Play" )
  77.     PORT_DIPSETTING(    0x00, "3/450 points" )
  78.     PORT_DIPSETTING(    0x08, "5/750 points" )
  79.     PORT_BIT ( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )    /* SLAM */
  80.     PORT_BITX( 0x20, IP_ACTIVE_HIGH, IPT_SERVICE | IPF_TOGGLE, DEF_STR ( Service_Mode ), KEYCODE_F2, IP_JOY_NONE )
  81.     PORT_BIT ( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON1 )    /* Serve */
  82.     PORT_BIT ( 0x80, IP_ACTIVE_LOW, IPT_VBLANK )    /* VBLANK */
  83.  
  84.     PORT_START /* IN2 */
  85.     PORT_ANALOG( 0xff, 0x00, IPT_PADDLE, 50, 10, 0x40, 0xb7 )
  86. INPUT_PORTS_END
  87.  
  88.  
  89.  
  90. static unsigned char palette[] =
  91. {
  92.     0x00,0x00,0x00, /* BLACK */
  93.     0xff,0xff,0xff, /* WHITE */
  94. };
  95.  
  96. static void init_palette(unsigned char *game_palette, unsigned short *game_colortable,const unsigned char *color_prom)
  97. {
  98.     memcpy(game_palette,palette,sizeof(palette));
  99. }
  100.  
  101.  
  102.  
  103. static struct DACinterface dac_interface =
  104. {
  105.     2,
  106.     { 100, 100 },
  107. };
  108.  
  109.  
  110. static struct MachineDriver machine_driver_avalnche =
  111. {
  112.     /* basic machine hardware */
  113.     {
  114.         {
  115.             CPU_M6502,
  116.             12096000/16,        /* clock input is the "2H" signal divided by two */
  117.             readmem,writemem,0,0,
  118.             avalnche_interrupt,32    /* interrupt at a 4V frequency for sound */
  119.         }
  120.     },
  121.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  122.     1,    /* single CPU, no need for interleaving */
  123.     0,
  124.  
  125.     /* video hardware */
  126.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 32*8-1 },
  127.     0,
  128.     sizeof(palette) / sizeof(palette[0]) / 3, 0,
  129.     init_palette,
  130.  
  131.     VIDEO_TYPE_RASTER,
  132.     0,
  133.     0,
  134.     0,
  135.     avalnche_vh_screenrefresh,
  136.  
  137.     /* sound hardware */
  138.     0,0,0,0,
  139.     {
  140.         {
  141.             SOUND_DAC,
  142.             &dac_interface
  143.         }
  144.     }
  145.  
  146. };
  147.  
  148.  
  149.  
  150. /***************************************************************************
  151.  
  152.   Game ROMs
  153.  
  154. ***************************************************************************/
  155.  
  156. ROM_START( avalnche )
  157.     ROM_REGION( 0x10000, REGION_CPU1 ) /* 64k for code */
  158.     /* Note: These are being loaded into a bogus location, */
  159.     /*         They are nibble wide rom images which will be */
  160.     /*         merged and loaded into the proper place by    */
  161.     /*         orbit_rom_init()                               */
  162.     ROM_LOAD( "30612.d2",         0x8800, 0x0800, 0x3f975171 )
  163.     ROM_LOAD( "30613.e2",         0x9000, 0x0800, 0x47a224d3 )
  164.     ROM_LOAD( "30611.c2",         0x9800, 0x0800, 0x0ad07f85 )
  165.  
  166.     ROM_LOAD( "30615.d3",         0xa800, 0x0800, 0x3e1a86b4 )
  167.     ROM_LOAD( "30616.e3",         0xb000, 0x0800, 0xf620f0f8 )
  168.     ROM_LOAD( "30614.c3",         0xb800, 0x0800, 0xa12d5d64 )
  169. ROM_END
  170.  
  171.  
  172.  
  173. static void init_avalnche(void)
  174. {
  175.     unsigned char *rom = memory_region(REGION_CPU1);
  176.     int i;
  177.  
  178.     /* Merge nibble-wide roms together,
  179.        and load them into 0x6000-0x7fff and e000-ffff */
  180.  
  181.     for(i=0;i<0x2000;i++)
  182.     {
  183.         rom[0x6000+i] = (rom[0x8000+i]<<4)+rom[0xA000+i];
  184.         rom[0xE000+i] = (rom[0x8000+i]<<4)+rom[0xA000+i];
  185.     }
  186. }
  187.  
  188.  
  189.  
  190. GAME( 1978, avalnche, 0, avalnche, avalnche, avalnche, ROT0, "Atari", "Avalanche" )
  191.